package com.yxhl.zoume.domain.interactor.coupon;

import com.yxhl.zoume.data.http.repository.coupon.CouponRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.busticket.PerfectCouponParam;
import com.yxhl.zoume.data.http.rest.response.coupon.PerfectCouponResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/11/10 .
 */

public class PerfectCouponUseCase extends UseCase<PerfectCouponResponse> {

    private  CouponRepository mRepository;

    @Inject
    public PerfectCouponUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                                @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                                CouponRepository repository) {
        super(uiThread, executorThread);
        mRepository = repository;
    }

    @Override
    protected Observable<PerfectCouponResponse> buildObservable(RequestParamImpl param) {
        return mRepository.queryPerfectCoupon((PerfectCouponParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
